(function(){"use strict";BX.namespace("BX.Landing.UI.Field");BX.Landing.UI.Field.Unit=function(t){BX.Landing.UI.Field.Text.apply(this,arguments);this.layout.classList.add("landing-ui-field-unit");this.unit=BX.Landing.UI.Field.Unit.createUnit();this.onInputHandler=typeof t.onInput==="function"?t.onInput:function(){};this.input.addEventListener("keydown",this.onInputKeydown.bind(this));this.input.addEventListener("input",BX.debounce(this.onInputInput,200,this));this.input.addEventListener("input",this.onInputInputWithoutDebounce.bind(this));this.input.value=t.content;this.input.placeholder=this.placeholder;this.items=t.items;this.unit.innerText=typeof t.unit==="string"?t.unit:"";this.input.min=typeof t.min==="number"?t.min:0;this.input.max=typeof t.max==="number"?t.max:Infinity;this.input.step=typeof t.step==="number"?t.step:1;this.frame=typeof t.frame==="object"?t.frame:null;this.selector=typeof t.selector==="string"?t.selector:null;this.property=typeof t.property==="string"?t.property:null;this.postfix=typeof t.postfix==="string"?t.postfix:"";this.format=typeof t.format==="function"?t.format:function(){};this.elements=null;if(this.frame){this.onFrameLoad()}this.layout.appendChild(this.unit);this.enableTextOnly()};BX.Landing.UI.Field.Unit.createUnit=function(){return BX.create("div",{props:{className:"landing-ui-field-unit-unit"}})};BX.Landing.UI.Field.Unit.prototype={constructor:BX.Landing.UI.Field.Unit,__proto__:BX.Landing.UI.Field.Text.prototype,onFrameLoad:function(){this.elements=[].slice.call(this.frame.document.querySelectorAll(this.selector));if(this.elements.length){var t=parseFloat(BX.style(this.elements[0],this.property));t=t===t?t:0;this.setValue(t)}},onInputInput:function(){this.onInputHandler(this)},onInputInputWithoutDebounce:function(){if(!!this.elements){this.elements.forEach(function(t){this.format(t,this.getValue(),this.items)},this)}},onInputKeydown:function(t){if(t.keyCode===13){t.preventDefault()}},createInput:function(){return BX.create("input",{props:{className:"landing-ui-field-input",type:"number"}})},setValue:function(t){this.input.value=t;BX.fireEvent(this.input,"input")},getValue:function(){return this.input.value},enableEdit:function(){if(this!==BX.Landing.UI.Field.BaseField.currentField&&BX.Landing.UI.Field.BaseField.currentField!==null){BX.Landing.UI.Field.BaseField.currentField.disableEdit()}BX.Landing.UI.Field.BaseField.currentField=this;this.input.focus()},disableEdit:function(){}}})();